<template>
  <div class="tab-box">
    <div v-if="navigator === 'mobile'" class="h5">
      <div class="navbar-title">
        {{ componentData.titleZh }}
      </div>
      <div v-for="(item, index) in componentData.list" :key="index" class="navbar-box">
        <div class="navbar-in">
          {{ item.titleZh }}
        </div>
        <div class="navbar-content">
          <div v-for="(d, zindex) in item.detail" :key="zindex" class="n-c-row">
            <p class="n-c-label">{{ d.nameZh }}</p>
            <p>{{ d.valueZh }}</p>
          </div>
        </div>
      </div>
    </div>
    <div v-else class="pc">
      <div class="navbar-title">
        {{ componentData.titleZh }}
      </div>
      <div class="navbar-box">
        <div
          v-for="(item, index) in componentData.list"
          :key="index"
          class="navbar-in"
          :class="{ active: currentNavbar === index }"
          @click="currentNavbar = index"
        >
          {{ item.titleZh }}
        </div>
      </div>
      <div class="navbar-content">
        <div v-for="(item, index) in currentDetail" :key="index" class="n-c-row">
          <p class="n-c-label">{{ item.nameZh }}</p>
          <p>{{ item.valueZh }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
    // 设备型号
    navigator: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      currentNavbar: 0,
    }
  },
  computed: {
    currentDetail() {
      return this.componentData.list[this.currentNavbar]?.detail || []
    },
  },
}
</script>

<style lang="less" scoped>
@import '~assets/var';

.tab-box {
  background-color: #121214;

  .h5 {
    width: 100%;
    padding: 30px 0 40px 0;
    color: #fff;

    .navbar-title {
      font-size: 18px;
      font-weight: bold;
      text-align: center;
    }

    .navbar-box {
      margin-top: 30px;
      padding: 0 24px;

      .navbar-in {
        font-size: 15px;
        font-weight: 500;
        line-height: 20px;
      }

      .navbar-content {
        .n-c-row {
          display: flex;
          background-color: #4c5055;
          font-size: 10px;
          height: 26px;
          line-height: 26px;
          margin-top: 10px;
        }

        p {
          padding-left: 10px;
        }

        .n-c-label {
          width: 105px;
          border-right: 1px solid #121214;
        }
      }
    }
  }

  .pc {
    .width(1200);
    .pd(60, 0, 80, 0);
    color: #fff;
    border: 1px dashed #e0e4ec;
    margin: 0 auto;

    .navbar-title {
      .ft(30);
      font-weight: bold;
    }

    .navbar-box {
      .mg(20, 0, 10, 0);
      display: flex;
      border-bottom: 1px solid #5f6268;
    }

    .navbar-in {
      .mg(0, 15, 0, 15);
      .lineH(36);
      .ft(18);
      align-items: center;
      display: flex;
      flex-direction: column;
      cursor: pointer;
      border-bottom: 1px solid #121214;

      &.active {
        border-bottom: 1px solid #fff;
      }

      &:nth-child(1) {
        margin: 0;
      }

      &:nth-child(2) {
        .mg(0, 15, 0, 30);
      }
    }

    .navbar-content {
      min-height: 100px;

      .n-c-row {
        display: flex;
        background-color: #4c5055;
        .ft(18);
        .height(52);
        .lineH(52);
        .mg(20, 0, 0, 0);
      }

      p {
        .pd(0, 0, 0, 20);
      }

      .n-c-label {
        .width(320);
        border-right: 1px solid #121214;
      }
    }
  }
}
</style>
